<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MY_Controller {
	function __construct(){
		parent::__construct();
		$this->load->model('page_model');
		$this->load->model('article_model');
		$this->load->model('gallery_model');
		$this->load->model('coltypes_model');
	}
  // public function index()
  // {
  //   $vdata['header'] =array(
  //     'title'=> $this->mcfg->get_config('site','title_seo')
  //     ,'tags'=> $this->mcfg->get_config('site','tags')
  //     ,'intro' => $this->mcfg->get_config('site','intro')
  //   );
  //
  //   # 在使用控制器时输出CI共模板使用
  //   $vdata['CI'] =& $this;
  //
  //   $this->load->view('welcome',$vdata);
  // }
  public function index(){
  	$data['news_nav']=$this->db->order_by('sort_id','asc')->get_where('coltypes',array('cid'=>4,'depth'=>0))->result_array();//获取新闻分类侧导分类
  	if(!empty($data['news_nav'])){
  		$nav=$this->db->order_by('sort_id','asc')->get_where('coltypes',array('cid'=>4,'fid'=>$data['news_nav'][0]['id'],'depth'=>1))->result_array();
  		if(!empty($nav)){
  			foreach($nav as $k=>$v){
  				$sid[]=$v['id'];
  			}
  		}
  		$data['molist']=$this->db->order_by('sort_id','desc')->get_where('article',array('cid'=>4,'in'=>array('ctype',$sid),'audit'=>1,'flag'=>1))->result_array();
  	}
  	
  	
  	$data['nhot']=$this->db->order_by('sort_id','desc')->get_where('article',array('cid'=>6,'audit'=>1,'flag'=>1))->result_array();
  	$this->load->view('welcome',$data);
  }

}
